package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import com.alibaba.druid.util.StringUtils;
import com.github.pagehelper.util.StringUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

/**
 *  日报
 */
@Getter@Setter
public class DailyPaper extends BaseDomain{
    /**
     * 0 普通
     * 1 热门
     * -1 禁用
     */
    public static final int STATE_COMMON=0;
    public static final int STATE_HOT=1;
    public static final int STATE_DISABLE=-1;

    //标题
    private String title;
    //封面
    private String coverUrl;
    //内容
    private String content;
    //状态
    private Integer state;


    public String getJson(){
        Map<String,Object> map=new HashMap();
        map.put("id",id);
        map.put("title",title);
        map.put("coverUrl",coverUrl);
        map.put("content",content);
        map.put("state",state);
        return JSONUtil.toJSONString(map);
    }


    public String getStateName(){
        String msg="普通";
        if(state==STATE_HOT){
            msg="热门";
        }else if(state==STATE_DISABLE){
            msg="禁用";
        }
        return msg;
    }

}